package everyday.leetcode;

/**
 * @Author: wenjingyuan
 * @Date: 2022/09/29/20:07
 * @Description:剑指 Offer II 024. 反转链表
 * https://leetcode.cn/problems/UHnkqh/
 */
public class Num024 {
    public ListNode reverseList(ListNode head) {
      ListNode cur=head;
      ListNode pre=null;
      while(cur!=null){
          ListNode temp=cur.next;
          cur.next=pre;
          pre=cur;
          cur=temp;
      }
      return pre;
    }
}
